{include file="public/layout" /}
<body style="background-color: #FFF; overflow: auto;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    {include file="channeltype/bar" /}
    <form class="form-horizontal" id="post_form" action="{:U('Channeltype/add')}" method="post">
        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit">
                    <label for="title"><em>*</em>模型名称</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="title" value="" id="title" class="input-txt">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="nid"><em>*</em>模型标识</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="nid" value="" id="nid" class="input-txt" onkeyup="this.value=this.value.replace(/[^a-zA-Z]/g,'');" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^a-zA-Z]/g,''));">
                    <span class="err"></span>
                    <p class="notic">标识必须是字母且唯一性，不可重复，不可更改</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="table"><em>*</em>数据表名</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="table" value="" id="table" class="input-txt">
                    <span class="err"></span>
                    <p class="notic">模型对应数据表名称，不包含表前缀({$prefix})</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="ctl_name"><em>*</em>控制器名</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="ctl_name" value="" id="ctl_name" class="input-txt">
                    <span class="err"></span>
                    <p class="notic">区分大小写，必须与相应的控制器名称保持一致</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="ntitle"><em>*</em>左侧菜单名称</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="ntitle" value="" id="ntitle" class="input-txt">
                    <span class="err"></span>
                    <p class="notic">只应用于后台左侧菜单</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="sort_order">排序</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="sort_order" value="100" id="sort_order" class="input-txt">
                    <span class="err"></span>
                    <p class="notic">越小越靠前</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>启用</label>
                </dt>
                <dd class="opt">
                    <div class="onoff">
                        <label for="status1" class="cb-enable selected">是</label>
                        <label for="status0" class="cb-disable ">否</label>
                        <input id="status1" name="status" value="1" type="radio" checked="checked">
                        <input id="status0" name="status" value="0" type="radio" >
                    </div>
                    <p class="notic"></p>
                </dd>
            </dl>
            <div class="bot">
                <a href="JavaScript:void(0);" onclick="checkForm();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    // 判断输入框是否为空
    function checkForm(){
        if($.trim($('input[name=title]').val()) == ''){
            showErrorMsg('模型名称不能为空！');
            $('input[name=title]').focus();
            return false;
        }
        if($.trim($('input[name=nid]').val()) == ''){
            showErrorMsg('模型标识不能为空！');
            $('input[name=nid]').focus();
            return false;
        }
        if($.trim($('input[name=table]').val()) == ''){
            showErrorMsg('数据表名不能为空！');
            $('input[name=table]').focus();
            return false;
        }
        if($.trim($('input[name=ctl_name]').val()) == ''){
            showErrorMsg('控制器名不能为空！');
            $('input[name=ctl_name]').focus();
            return false;
        }
        if($.trim($('input[name=ntitle]').val()) == ''){
            showErrorMsg('左侧菜单名称不能为空！');
            $('input[name=ntitle]').focus();
            return false;
        }
        layer_loading('正在处理');
        $('#post_form').submit();
    }
</script>
</body>
</html>